﻿// *----------------------------------------------------------------
// Copyright (C) 2017 通通优品
// 版权所有。
// 
// 类名：QuartzConfiguration.cs
// 功能描述：TongTongMall.Quartz
// 
// Create User：jym 2017/02/16
// 
// Edit User：UserName,EditTime
// Describe：Describe
// ----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Quartz;
using Quartz.Impl;
using System.Collections.Specialized;

namespace TongTongMall.Quartz.Quartz
{
    public class QuartzConfiguration : IQuartzConfiguration
    {
        public IScheduler Scheduler
        {
            get
            {
                var properties = new NameValueCollection
                {
                    ["quartz.plugin.triggHistory.type"] = "Quartz.Plugin.History.LoggingJobHistoryPlugin",
                    ["quartz.plugin.jobInitializer.type"] = "Quartz.Plugin.Xml.XMLSchedulingDataProcessorPlugin",
                    ["quartz.plugin.jobInitializer.fileNames"] = "quartz_jobs.xml",
                    ["quartz.plugin.jobInitializer.failOnFileNotFound"] = "true",
                    ["quartz.plugin.jobInitializer.scanInterval"] = "86400"
                };
                ISchedulerFactory sf = new StdSchedulerFactory(properties);
                return sf.GetScheduler();
            }
        }
    }
}
